package com.ccjq.yaoqing.controller;

import com.ccjq.yaoqing.domain.Address;
import com.ccjq.yaoqing.domain.Student;
import com.ccjq.yaoqing.service.StudentService;
import com.ccjq.yaoqing.service.impl.StudentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * describe: 主页面
 *
 * @author xugang
 * @date 2018/12/7 14:55
 */
public class HomeController extends HttpServlet {

    private StudentService service = new StudentServiceImpl();

    public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        doPost(req, resp);
    }

    public void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        Address addr = service.getTimeAndAddress();
        req.getSession().setAttribute("result", addr);
        req.getRequestDispatcher("WEB-INF/view/check_in.jsp").forward(req, resp);
    }
}
